package com.zhengtoudai.ui.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.zhengtoudai.R;
import com.zhengtoudai.ui.bean.MessageCenterModel;
import com.zhengtoudai.view.recyclerview.RecyclerViewAdapter;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * author:xiejingwen
 */
public class MessageCenterAdapter extends RecyclerViewAdapter<MessageCenterAdapter.ViewHolder,MessageCenterModel.MessageCenterBean.MessageCenterList> {

    @Override
    public ViewHolder mOnCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_message_center, parent, false);
        return new ViewHolder(view);
    }

    @Override
    public void mOnBindViewHolder(ViewHolder holder, int position) {
        holder.tvTitle.setText(data.get(position).getMessageTitle());
        holder.tvContent.setText(data.get(position).getMessageContent());
        holder.tvDate.setText(data.get(position).getMessageSendDateTime());
    }



    static class ViewHolder extends RecyclerView.ViewHolder{
        @Bind(R.id.tv_title)
        TextView tvTitle;
        @Bind(R.id.tv_date)
        TextView tvDate;
        @Bind(R.id.tv_content)
        TextView tvContent;

        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }
}
